//
// Created by jinbang.li on 2023/6/22.
//

#include "OpTexture.h"
#include "../Log/OpLog.h"
#include "./OpEGL.h"
#include "../Shader/OpShader.h"
class COpTexture:public OpTexture{
public:
    OpShader shader;
    virtual bool Init(void *win){
        if (!win){
            return false;
        }
        if (!OpEGL::Get()->Init(win))return false;
        shader.Init();
        return true;
    }
    virtual void Draw(unsigned char *data[],int width,int height){
        shader.GetTexture(0,width,height,data[0]);
        shader.GetTexture(1,width>>1,height>>1,data[1]);
        shader.GetTexture(2,width>>1,height>>1,data[2]);
        shader.Draw();
        OpEGL::Get()->Draw();
    }
};
OpTexture *OpTexture::Create() {
    return new COpTexture();
}